import * as echarts from 'echarts'

export function getRingOptions (current) {
    return {
        title: {},
        tooltip: {
            trigger: 'item'
        },
        series: [
            {
                type: 'pie',
                clockWise: false,
                startAngle: 90,
                radius: ['50%', '70%'],
                data: [100],
                itemStyle: {
                    color: '#eee'
                },
                animation: false
            },
            {
                name: '',
                type: 'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    show: false,
                    position: 'center'
                },
                labelLine: {
                    show: false
                },
                color: ['#ddd', '#ddd'],
                showBackground: true,
                data: [
                    {
                        value: current,
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(
                                    0,
                                    0,
                                    0,
                                    1,
                                    [
                                        {
                                            offset: 0,
                                            color: '#35cdf3',
                                        },
                                        {
                                            offset: 1,
                                            color: '#12e4a0',
                                        },
                                    ],
                                    false
                                ),
                                borderRadius: ['50%', '50%']
                            }
                        }
                    },
                    {
                        value: 100 - current,
                        itemStyle: {
                            normal: {
                                color: 'transparent',
                                borderCap: 'round'
                            }
                        }
                    }
                ]
            }
        ]
    };
}
export function getLineOptions ({xData,yData1,yData2}) {
    return{
        tooltip: {
            show: true,
            // alwaysShowContent: true,
        },
        legend: {
            icon:"circle",
            show: true,
            top: 0,
            right:0,
            textStyle: {
                fontSize: 12,
                color: '#c8c8c8'
            },

        },
        grid: {
            left: '3%',
            right: '3%',
            top: '15%',
            bottom: '6%',
            containLabel: true
        },
        xAxis: {
            axisLine: {
                show: false
            },
            axisTick: {
                show: false
            },
            data: xData
        },
        yAxis: {
            name:"车数",
            nameTextStyle:{
                padding:[0,0,0,-30]
            },
            axisLine: {
                show: false,
            },
            axisTick: {
                show: false
            },
        },
        series: [
           {
                name:'计划请车数',
                type: 'line',
                smooth: true,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        color: '#46BFEA',
                    }
                },
                itemStyle: {
                    color: '#46BFEA',
                    borderWidth: 2,
                },
               areaStyle: {
                   opacity:.2
               },
                data: yData1
            },
            {
                name:'承认车数',
                type: 'line',
                smooth: true,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        color: '#57EBC6',
                    }
                },
                itemStyle: {
                    color: '#57EBC6',
                    borderWidth: 2,
                },
                areaStyle: {
                    opacity:.2
                },
                data: yData2
            },
        ]
    }
}